public class FactorialRunnableTester
{
    public static void main(String[] args)
    {
        FactorialThread2 f2 = new FactorialThread2(5);

        Thread t1 = new Thread(f2);

//        t1.start();

        new Thread(f2).start();
    }
}

class FactorialThread2 implements Runnable
{
    private int num;

    public FactorialThread2(int num)
    {
        this.num = num;
    }

    public void run()//计算整数阶乘
    {
        int ret = 1;

        for (int i = 1; i <= num; i++)
        {
            ret *= i;
        }

        System.out.println(num + "的阶乘为: " + ret);
    }
}
